const mongoose = require('mongoose');

const UserSchema = new mongoose.Schema(
  {
    name: { type: String, required: true , unique: true},
    password: { type: String, required: true },
    avatar: { type: String },
    like: { type: Number, default: 0},
  },
  { timestamps: true }
)

UserSchema.methods.toString = function () {
  return this.name
}

mongoose.model('User', UserSchema)
